package com.zerui.manager.app.deviceTouchSync.executer;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.zerui.manager.deviceTouchSync.DeviceTouchSync;
import com.zerui.manager.deviceTouchSync.domainservice.DeviceTouchSyncRepository;
import com.zerui.manager.web.enums.AuthTaskSyncStatusEnum;
import com.zerui.manager.web.enums.DeviceSyncStatusEnum;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * @Author wh
 * @create_time 2023-08-23 16:29
 */
@Component
@CatchAndLog
public class DeviceTouchSyncUpdateCmdExe {

    @Resource
    private DeviceTouchSyncRepository deviceTouchSyncRepository;

    /**
     * 门禁设备落地同步状态
     *
     * @param id
     * @param authTaskSyncStatusEnum
     */
    public void syncStatus(Long id, AuthTaskSyncStatusEnum authTaskSyncStatusEnum, LocalDateTime date) {
        deviceTouchSyncRepository.syncStatus(id, authTaskSyncStatusEnum.getCode(), date);
    }

    /**
     * 更新同步信息
     *
     * @param touchSync
     */
    public void updateSyncInfo(DeviceTouchSync touchSync) {
        deviceTouchSyncRepository.updateSyncInfo(touchSync);
    }
}
